﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Eeml.Core
{
    public class Location
    {
        #region Fields

        private string _name;
        private string _exposure;
        private string _domain;
        private string _disposition;

        private double _latitude;
        private double _longitude;
        private double _elevation;

        #endregion

        #region Contructors

        public Location()
        { }

        #endregion

        #region Properties

        public double Latitude
        {
            get
            {
                return _latitude;
            }
            set
            {
                _latitude = value;
            }
        }

        public double Longitude
        {
            get
            {
                return _longitude;
            }
            set
            {
                _longitude = value;
            }
        }

        public double Elevation
        {
            get
            {
                return _elevation;
            }
            set
            {
                _elevation = value;
            }
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Name value cannot be null or empty", "value");
                }
                _name = value;
            }
        }
        
        public string Exposure
        {
            get
            {
                return _exposure;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Exposure value cannot be null or empty", "value");
                }

                if (value != ExposureType.Indoor && value != ExposureType.Outdoor)
                {
                    throw new ArgumentException("Unknown exposure type. Exposure must be either Indoor or Outdoor. The supplied type was: " + value);
                }

                _exposure = value;
            }
        }

        public string Domain
        {
            get
            {
                return _domain;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Domain value cannot be null or empty", "value");
                }

                if (value != DomainType.Physical && value != DomainType.Virtual)
                {
                    throw new ArgumentException("Unknown domain type. Domain must be either Physical or Virtual. The supplied type was: " + value);
                }

                _domain = value;
            }
        }

        public string Disposition
        {
            get
            {
                return _disposition;
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Disposition value cannot be nulll or empty", "value");
                }

                if (value != DispositionType.Fixed && value != DispositionType.Mobile)
                {
                    throw new ArgumentException("Unknown disposition type. Disposition must be either Fixed or Mobile. The supplied type was: " + value);
                }

                _disposition = value;
            }
        }

        #endregion

        #region Methods
        #endregion
    }
}
